home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Plug-In Power Pack for Netscape Communicator
/
Plug-In Power Pack for Netscape Communicator.iso
/
plugins
/
dataviews
/
dvtools
/
demos
/
telecomdemo
/
msg_log.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-05-08
|
4KB
|
167 lines
#ifndef lint
static char SccsId[]= "@(#)msg_log.c V1.6 3/17/95";
#endif
/*
| File name: message.c
|========================================================================
|
| Copyright (c) 1990 -- V.I. Corporation
|
|========================================================================
*/
#include "simulate.h"
#include "tlc_fundecl.h"
/*
* Define the normal input mask for this screen.
*/
#ifdef WINNT
#define NORMAL_MASK ( (ULONG)V_BUTTONPRESS | V_BUTTONRELEASE | V_KEYPRESS | \
V_WINDOW_QUIT | V_EXPOSE | V_RESIZE )
#else /* Not WINNT */
#define NORMAL_MASK ( (ULONG)V_EXPOSE | V_RESIZE )
#endif /* WINNT */
#define DEF_COLORTABLE (ADDRESS)NULL
#define LIST_SIZE 5
LOCAL DRAWPORT LogDp;
LOCAL OBJECT LogObj[LIST_SIZE];
LOCAL INT LogCnt = 0;
LOCAL DV_BOOL LogScrolling = NO;
/*
* CreateLogScreen -- create the status screen and setup the event mask.
*/
void CreateLogScreen
V_P_ ((void))
{
VIEW view;
OBJECT drawing, area;
RECTANGLE area_vp, dummy;
CHAR obj_name[5];
INT i;
#ifdef WINNT
LogScreen = TscOpenSet( "W", DEF_COLORTABLE,
V_WIN32_ICON_NAME, "teleicon",
V_WINDOW_HEIGHT, 120,
V_WINDOW_WIDTH, 550,
V_WINDOW_X, 240,
V_WINDOW_Y, 453,
#ifdef DOUBLE_BUFFER
V_WIN32_DOUBLE_BUFFER, YES,
#endif /* DOUBLE_BUFFER */
V_WINDOW_NAME, "Network Log",
V_INITIAL_CURSOR,
V_END_OF_LIST );
#else /* Not WINNT */
LogScreen = TscOpenSet(NULL, DEF_COLORTABLE,
V_WINDOW_HEIGHT, 150,
V_WINDOW_WIDTH, 650,
V_WINDOW_X, 450,
V_WINDOW_Y, 700,
V_X_EXPOSURE_BLOCK, YES,
V_WINDOW_NAME, "Network Log",
V_INITIAL_CURSOR,
V_END_OF_LIST);
#endif /* WINNT */
(VOID) VOscWinEventMask ((ULONG) NORMAL_MASK, 0L);
view = TviLoad (MsgLogViewName);
EXIT_IF_INVALID (view,
"\nAborted: Log View can't be loaded.\n");
drawing = TviGetDrawing (view);
area = TdrGetNamedObject (drawing, "area");
VOobBox (area, &area_vp, &dummy);
LogDp = TdpCreateStretch (LogScreen, view, NULL, &area_vp);
for (i = 0; i < LIST_SIZE; i++)
{
sprintf (obj_name, "%d", i);
LogObj[i] = TdrGetNamedObject (drawing, obj_name);
VOtxSetString (LogObj[i], "");
}
TdpDraw (LogDp);
}
void
OutputLog (msg)
char *msg;
{
INT i;
if (LogScrolling)
{
for (i = 0; i < LIST_SIZE - 1; i++)
{
TdpEraseObject (LogDp, LogObj[i]);
VOtxSetString (LogObj[i], VOtxGetString (LogObj[i + 1]));
TdpDrawObject (LogDp, LogObj[i]);
}
TdpEraseObject (LogDp, LogObj[i]);
VOtxSetString (LogObj[i], msg);
TdpDrawObject (LogDp, LogObj[i]);
}
else
{
VOtxSetString (LogObj[LogCnt], msg);
TdpDrawObject (LogDp, LogObj[LogCnt]);
LogCnt++;
if (LogCnt == LIST_SIZE)
LogScrolling = YES;
}
}
/*
* DestroyLogScreen -- called at program termination. Destroy all
* drawports associated with this screen, then close the window.
*/
void DestroyLogScreen
V_P_ ((void))
{
(VOID) TscSetCurrentScreen (LogScreen);
(VOID) TdpDestroy (LogDp);
(VOID) TscClose (LogScreen);
}
/*
* HandleLogInput -- deal with input to the status window. Deal with
* window events.
*/
void
HandleLogInput (location)
OBJECT location;
{
switch (VOloType (location))
{
/*
* Deal with window system events.
*/
case V_EXPOSE:
TscRedraw (LogScreen, VOloRegion (location));
break;
case V_RESIZE:
TscReset (LogScreen);
break;
default:
break;
}
}